<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE>
<html>
<head>
<jsp:include page="../header.jsp"> 
	<jsp:param value="已删除学员" name="title"/>
</jsp:include>
</head>
<link href="static/css/base-css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function dow() {
	$('.ui.labeled.icon.sidebar').sidebar('setting', 'transition', 'overlay')
			.sidebar('toggle');
}
$(function(){
	$('.browse').popup({
		inline : true,
		hoverable : true,
		position : 'right center',
	});
	
	$('.link').popup({
	    position:'bottom center'
	  })
	;

	$("div.checkbox").checkbox();
	var checkAll = $("#checkAll");
	var itemCheck = $(".item-check");
	checkAll.on("change", function() {
		itemCheck.prop("checked", this.checked);
	});

	itemCheck.on("change", function() {
		// 判断判断选中的个数是否和所有存在个数一样
		var checkeds = $(".item-check:checked");
		// 修改checkAll的checked属性
		checkAll.prop("checked", checkeds.length == itemCheck.length);
	});

	// 批量删除按钮
	$("#record").on("click", function() {
		// 获取所有选中
		var checkeds = $(".item-check:checked");
		if (checkeds.length && confirm("确认要恢复所有选中行吗？")) {
			var ids = [];
			checkeds.each(function() {
				ids.push(this.value); 
			});
			//alert(ids);
			// 建立恢复连接
			location.replace("student/recover?sid=" + ids.join("&sid="));
		}
	});
});
</script>
<body>
	<jsp:include page="../menu/delete_emp_menu.jsp"></jsp:include>
	<div class="teacher-content" style="margin-right: 100px;margin-left: 210px;margin-top: 50px;">
		<table class="ui celled striped table">
			<thead> 
				<tr>
					<th colspan="8" style="vertical-align:middle">
					已删除的学员 
					</th>
				</tr>
				<tr >
					<th colspan="8">
					<div class="ui teal basic button" tabindex="0" id="record"  style="float:left;">一键恢复</div>
						<form>
					    	<div class="ui mini icon input" style="float: right;">
					  			<input type="text" placeholder="请输入搜索关键字" name="userName" value="${param.userName }">
					  			<i class="search icon"></i>
							</div>
						</form>
					</th>
				</tr>
			</thead>
			<tbody>
				<tr id="tr2">
					<td class="collapsing">
						<div class="ui checkbox">
							<input type="checkbox" id="checkAll">
						</div>
					</td>
					<td class="collapsing">姓名</td>
					<td class="collapsing">性别</td>
					<td class="collapsing">来源</td>
					<td class="collapsing">电话</td>
					<td class="collapsing">创建时间</td>
					<td class="collapsing">分配状态</td>
					<td class="collapsing">&nbsp</td>
				</tr>
				<c:forEach items="${stuList }" var="stu">
      <tr id="tr2">
     	 <td>
	      	<div class="ui checkbox">
				<input type="checkbox" class="item-check" value="${stu.id}">
			</div>
		</td>
        <td>
 			 <a class="browse item" href="student/add?sid=${stu.id }" style="color:#666">
 			   ${stu.name}
 			 </a>
			  <div class="ui fluid popup  bottom left transition hidden" style="max-width:300px;">
			    <div class="ui four column relaxed divided grid" >
			      <div class="column" style="text-align: left;">
			        <h5 class="ui header" style="width:200px;">详细资料</h5>
			        <div class="ui link list">
			          <a class="item" style="width:200px;">学历：${stu.education }</a>
			          <a class="item" style="width:200px;">身份证号码：${stu.idCard}</a>
			          <a class="item" style="width:200px;">QQ号码：${stu.qq}</a>
			          <a class="item" style="width:200px;">父亲姓名：${stu.fatherName }</a>
			          <a class="item" style="width:200px;">父亲电话：${stu.fatherTel }</a>
			          <a class="item" style="width:200px;">母亲姓名：${stu.motherName }</a>
			          <a class="item" style="width:200px;">母亲电话：${stu.motherTel }</a>
			          <a class="item" style="width:200px;">录入者：${stu.creator }</a>
			          <a class="item" style="width:200px;">状态：${stu.status }</a>
			        </div>
			      </div>
			    </div>
			  </div>
        </td>
        <td>${stu.gender}</td>
        <td>${stu.source }</td>
        <td>${stu.phone}</td>
        <td><fmt:formatDate value="${stu.createTime}" type="both"/></td> 
        <td class="negative">${stu.isAllocation }</td>
        <td>
        	<a onclick="return confirm('确认恢复？')"
				class="ui label" style="color:#fff; background: #666;"
				href="student/recover?sid=${stu.id}"> 恢复
			</a>
        </td>
      </tr>
      </c:forEach>
      <c:if test="${empty stuList}">
		<tr>
			<td style="text-align: center;" colspan="8">暂无记录</td>
		</tr>
	  </c:if>
    </tbody>
  </table>
  	<c:if test="${totalPage > 1 }">
			<div class="page">
				<a <c:if test="${page!=1}">href="show/delete/stu?page=1${queryString}"</c:if>
					class="${page == 1?'disable':''}" style="color:#666"><i class="fast backward icon"></i>首页
				</a>
				<a <c:if test="${page!=1}">href="show/delete/stu?page=${page-1}${queryString}"</c:if>
					class="${page == 1?'disable':''}" style="color:#666"><i class="backward icon"></i>上一页
				</a>
				<a <c:if test="${page!=totalPage}">href="show/delete/stu?page=${page+1 }${queryString}"</c:if>
					class="${page == totalPage?'disable':''}" style="color:#666">下一页<i class="forward icon"></i>
				</a>
				<a <c:if test="${page!=totalPage}">href="show/delete/stu?page=${totalPage }${queryString}"</c:if>
					class="${page == totalPage?'disable':''}" style="color:#666">尾页<i class="fast forward icon"></i>
				</a>
				<span style="float:right">${page}/${totalPage }</span>
					
			</div>
		</c:if>
		</div>
</body>
</html>